package org.skill.panel;

import com.updateNew.MyIsif;
import org.come.until.ScrollUI;
import org.come.until.SrcollPanelUI;
import java.awt.image.ImageObserver;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import javax.swing.plaf.ScrollBarUI;
import org.come.until.ScrollUIS;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.ListModel;
import com.tool.tcpimg.UIUtils;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JScrollPane;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;

 

public class SetupJpanel3 extends JPanel
{
    private String backPath;
    private int width;
    private int heigth;
    private JList<String> jlist;
    private DefaultListModel<String> listModel;
    public static JScrollPane jScrollPane;
    private ImageIcon iconS;
    private ImageIcon iconH;
    private ImageIcon iconD;

    public JList<String> getJlist() {
        if (this.jlist == null) {
            (this.jlist = new JList()).setSelectionBackground(new Color(122, 117, 112));
            this.jlist.setSelectionForeground(Color.white);
            this.jlist.setForeground(Color.white);
            this.jlist.setFont(UIUtils.TEXT_FONT1);
            this.jlist.setBackground(UIUtils.Color_BACK);
            this.jlist.setOpaque(false);
            this.jlist.setModel(this.getListModel());
        }
        return this.jlist;
    }

    public void setJlist(final JList<String> jlist) {
        this.jlist = jlist;
    }

    public DefaultListModel<String> getListModel() {
        if (this.listModel == null) {
            this.listModel = new DefaultListModel();
        }
        return this.listModel;
    }

    public void setListModel(final DefaultListModel<String> listModel) {
        this.listModel = listModel;
    }

    public String getBackPath() {
        return this.backPath;
    }

    public void setBackPath(final String backPath) {
        this.backPath = backPath;
    }

    @Override
    public int getWidth() {
        return this.width;
    }

    public void setWidth(final int width) {
        this.width = width;
    }

    public int getHeigth() {
        return this.heigth;
    }

    public void setHeigth(final int heigth) {
        this.heigth = heigth;
    }

    public SetupJpanel3(final int width, final int heigth, final String[] rowData) {
        this.width = width;
        this.heigth = heigth;
        this.setPreferredSize(new Dimension(width, heigth));
        this.setLayout(null);
        this.setOpaque(true);
        (SetupJpanel3.jScrollPane = new JScrollPane((Component)this.getJlist())).setVerticalScrollBarPolicy(22);
        SetupJpanel3.jScrollPane.getVerticalScrollBar().setUI(new ScrollUIS());
        SetupJpanel3.jScrollPane.getViewport().setOpaque(false);
        SetupJpanel3.jScrollPane.setOpaque(false);
        SetupJpanel3.jScrollPane.setBounds(0, 0, width, heigth - 1);
        SetupJpanel3.jScrollPane.setBorder(BorderFactory.createEmptyBorder());
        SetupJpanel3.jScrollPane.setHorizontalScrollBarPolicy(31);
        this.add((Component)SetupJpanel3.jScrollPane);
        if (rowData != null) {
            int i = 0;
            while (i < rowData.length) {
                this.getListModel().add(i, rowData[i]);
                ++i;
            }
        }
    }

    public void clearModelContent(final String[] rowData) {
        this.getListModel().clear();
        if (rowData != null) {
            int i = 0;
            while (i < rowData.length) {
                this.getListModel().add(i, rowData[i]);
                ++i;
            }
        }
    }

    @Override
    protected void paintComponent(final Graphics g) {
        super.paintComponent(g);

        if("水墨UI".equals(MyIsif.getStyle())) {
            SetupJpanel3.jScrollPane.getVerticalScrollBar().setUI(new SrcollPanelUI());
            SetupJpanel3.jScrollPane.getViewport().setViewSize(new Dimension(this.jlist.getWidth(), this.jlist.getHeight() + 1));
            SetupJpanel3.jScrollPane.setBounds(2, 4, this.width, this.heigth - 6);
            this.iconH = new ImageIcon("inkImg/newbackground/xln100x.png");
            g.drawImage(this.iconH.getImage(), 0, 0, this.width, this.heigth, (ImageObserver)this);
        }else{
            SetupJpanel3.jScrollPane.getVerticalScrollBar().setUI(new SrcollPanelUI());
            SetupJpanel3.jScrollPane.getViewport().setViewSize(new Dimension(this.jlist.getWidth(), this.jlist.getHeight() + 1));
            SetupJpanel3.jScrollPane.setBounds(2, 4, this.width, this.heigth - 6);
            this.iconH = new ImageIcon("inkImg/hongmu/xln100xh.png");
            g.drawImage(this.iconH.getImage(), 0, 0, this.width, this.heigth, (ImageObserver)this);
        }

    }

    public static JScrollPane getjScrollPane() {
        return SetupJpanel3.jScrollPane;
    }

    public static void setjScrollPane(final JScrollPane jScrollPane) {
        SkillSMSelectOptionJpanel1.jScrollPane = jScrollPane;
    }
}
